package ywxt.tool.stool.common.mapper

import ywxt.tool.stool.entity.PoetEntity
import ywxt.tool.stool.model.PoetModel

fun PoetEntity.toPoetModel(): PoetModel {
    requireNotNull(id)
    return PoetModel(id, name, gender, dynasty, summary)
}

inline fun PoetEntity.toPoetModel(block: PoetModel.() -> Unit): PoetModel {
    val model = toPoetModel()
    block(model)
    return model
}